package com.shuzijun.leetcode.editor.cn;

import java.util.ArrayList;
import java.util.List;

public class Subsets{
    public static void main(String[] args) {
         
         Solution solution = new Subsets().new Solution();
        
        
    }
    //leetcode submit region begin(Prohibit modification and deletion)
class Solution {
        private ArrayList<List<Integer>> result = new ArrayList<>();
        public List<List<Integer>> subsets(int[] nums) {
            backTrack(nums,0,new ArrayList<Integer>());
            return result;
    }

        private void backTrack(int[] nums, int k, ArrayList<Integer> path) {
            if (k == nums.length){
                result.add(new ArrayList<>(path));
                return;
            }

            backTrack(nums,k+1,path);
            path.add(nums[k] );
            backTrack(nums,k+1,path);
            path.remove(path.size()-1);
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}